package leetcode.medium.hIndex;

import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

public class SolutionTest {
    private static Solution solution;

    @BeforeClass
    public static void setup() {
        solution = new Solution();
    }

    @AfterClass
    public static void tearUp() {
        solution = null;
    }

    @Test
    public void test1() {
        int[] citations = new int[]{3, 0, 6, 1, 5};
        Assert.assertEquals(3, solution.hIndex(citations));
    }

    @Test
    public void test2() {
        int[] citations = new int[]{1, 3, 1};
        Assert.assertEquals(1, solution.hIndex(citations));
    }

    @Test
    public void test3() {
        int[] citations = new int[]{1};
        Assert.assertEquals(1, solution.hIndex(citations));
    }

    @Test
    public void test4() {
        int[] citations = new int[]{100};
        Assert.assertEquals(1, solution.hIndex(citations));
    }

    @Test
    public void test5() {
        int[] citations = new int[]{0};
        Assert.assertEquals(0, solution.hIndex(citations));
    }

    @Test
    public void test6() {
        int[] citations = new int[]{0, 1};
        Assert.assertEquals(1, solution.hIndex(citations));
    }

    @Test
    public void test7() {
        int[] citations = new int[]{11, 15};
        Assert.assertEquals(2, solution.hIndex(citations));
    }

    @Test
    public void test8() {
        int[] citations = new int[]{1, 2, 2};
        Assert.assertEquals(2, solution.hIndex(citations));
    }
}
